package com.test.vue.controller;

import com.test.vue.entity.Country;
import com.test.vue.service.CountryService;
import com.test.vue.utils.ReturnResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//这个是ztree的Demo
@RestController
public class ZtreeController {
    @Autowired
    CountryService countryService;

    @RequestMapping(value = "/ztreeTest",method = { RequestMethod.POST, RequestMethod.GET })
    public ReturnResult getCountry(){
        List<Country> list = countryService.getCountryList();
        if(list!=null){
            return ReturnResult.build(200,list);
        }

        return ReturnResult.build(400,"查询数据失败");
    }
}
